home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 March / CMCD0305.ISO / Software / Shareware / Utilitare / emu / Emu8086_Setup_307c.exe / {app} / Samples / scasb.asm < prev    next >
Assembly Source File  |  2002-08-02  |  728b  |  57 lines

  1. ; This sample shows how
  2. ; to use SCASB instruction
  3. ; to find a symbol.
  4.  
  5. #make_COM#
  6.  
  7. ; COM file is loaded at 100h
  8. ; prefix:
  9.     ORG 100h
  10.  
  11. ; set forward direction:
  12.     CLD
  13.  
  14. ; set counter to string size:
  15.     MOV CX, 10
  16.  
  17. ; load string address
  18. ; into ES:DI
  19.     MOV AX, CS
  20.     MOV ES, AX
  21.     LEA DI, str1
  22.  
  23. ; we will look for the 'C'
  24. ; character in string:
  25.     MOV AL, 'C'
  26.  
  27.     REPNE   SCASB
  28.  
  29.     JZ  found
  30.  
  31. not_found:
  32.  
  33. ; "No" - not found!
  34.     MOV AL, 'N'
  35.     MOV AH, 0Eh
  36.     INT 10h
  37.  
  38.     JMP exit_here
  39. found:
  40.  
  41. ; "Yes" - found!
  42.     MOV AL, 'Y'
  43.     MOV AH, 0Eh
  44.     INT 10h
  45.  
  46. ; DI contains the
  47. ; offset of 'C' character:
  48.     DEC DI  
  49.  
  50. exit_here:
  51.     RET
  52.  
  53. str1 DB 'AAABBBCDDD'
  54.  
  55.  
  56. END
  57.